package edu.sjb.gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JWindow;

import edu.sjb.constants.ImageConstants;

@SuppressWarnings("serial")
public class SplashScreen extends JWindow {
	protected int duration;

	public SplashScreen(int d) {
		duration = d;
	}

	public void showUp() {
		JPanel content = (JPanel) getContentPane();
		content.setBackground(Color.white);
		int width = 558;
		int height = 640;
		Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
		int x = (screen.width - width) / 2;
		int y = (screen.height - height) / 2;
		setBounds(x, y, width, height);
		ImageIcon img = new ImageIcon(ImageConstants.SPLASH);
		JLabel label = new JLabel(img);
		content.add(label, BorderLayout.CENTER);
		setVisible(true);
		try {
			Thread.sleep(duration);
		}
		catch (Exception e) {
		}
	}
}
